package com.mega32k.mevila.util;

import net.minecraft.block.Block;
import net.minecraft.block.ComposterBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.WorldGenRegistries;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.placement.Placement;
import net.minecraft.world.gen.placement.TopSolidRangeConfig;
import net.minecraftforge.event.world.BiomeLoadingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class OreGenerate {
    public static ConfiguredFeature<?, ?> MEVILA_DUST_ORE;

    public static void og() {
        MEVILA_DUST_ORE = (ConfiguredFeature<?, ?>)((ConfiguredFeature)((ConfiguredFeature) Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD, BlockInit.MEVILA_DUST_ORE_BLOCK.get().getDefaultState(), 8)).range(4).square().chance(4).withPlacement(Placement.RANGE.configure(new TopSolidRangeConfig(2, 0, 17)))));
        Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation("mevila","mevila_dust_ore_block"), MEVILA_DUST_ORE);
    }

    @SubscribeEvent
    public static void biomeModification(BiomeLoadingEvent event) {
        og();
        event.getGeneration().getFeatures(GenerationStage.Decoration.UNDERGROUND_ORES).add(() -> MEVILA_DUST_ORE);
    }
}
